<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-card-body">
            <!--    账单统计        -->
            <div class="layui-field-box">
                <div class="billMian">
                    <div class="bill-title">柜子业务月度统计</div>
                    <div class="layui-row layui-col-space10 bill">
                        <div class="layui-col-md2">
                            <div class="billBox">
                                <h3>累计账单金额（元人民币）</h3>
                                <p id="totalMoney"></p>
                            </div>
                        </div>
                        <div class="layui-col-md2">
                            <div class="billBox">
                                <h3>累计已结算账单金额（元人民币）</h3>
                                <p id="billSettledMoney"></p>
                            </div>
                        </div>
                        <div class="layui-col-md2">
                            <div class="billBox">
                                <h3>待结算账单金额（元人民币）</h3>
                                <p id="billNosettledMoney"></p>
                            </div>
                        </div>
                        <div class="layui-col-md2">
                            <div class="billBox">
                                <h3>上月账单金额（元人民币）</h3>
                                <p id="lastTotalMoney"></p>
                            </div>
                        </div>
                        <div class="layui-col-md2">
                            <div class="billBox">
                                <h3>本月已签收金额（元人民币）</h3>
                                <p id="NowBillSettledMoney"></p>
                            </div>
                        </div>
                        <div class="layui-col-md2">
                            <div class="billBox">
                                <h3>总账单数（条）</h3>
                                <p id="count"></p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!--      头部操作      -->
            <div class="layui-form lay-header">
                <div class="toolbar">
                    <div class="layui-form-item lay-query-content">
                        <div class="lay-query-box">
                            <div class="query-lt">
                                <div class="layui-inline">
                                    <label class="layui-form-label">账单编号:</label>
                                    <div class="layui-input-inline">
                                        <input type="text" class="layui-input" name="billNo" placeholder="账单名称/编号">
                                    </div>
                                </div>
                                <div class="layui-inline">
                                    <label class="layui-form-label">起始日期:</label>
                                    <div class="layui-input-inline">
                                        <input name="createTime" id="pTime" class="layui-input date-icon" type="text"
                                               placeholder="选择时间" style="width: 200px" readonly/>
                                    </div>
                                    <input name="startTime" id="sTime" type="hidden"/>
                                    <input name="endTime" id="eTime" type="hidden"/>
                                </div>
                            </div>
                            <div class="query-rt">
                                <div class="layui-inline">
                                    <button class="layui-btn icon-btn color-green" lay-filter="formSubSearchLog" lay-submit layui-form-keyDownSearch="true">查询</button>
                                    <button class="layui-btn icon-btn color-white" lay-filter="resets" lay-submit>重置</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!--   账单列表        -->
            <table class="layui-table" id="billTable" lay-filter="billTable"></table>
        </div>
    </div>
</div>
<style>
    .billMian {
        margin-bottom: 25px;
        border-bottom: 1px solid #e0dfdf;
    }

    .bill {
        box-sizing: border-box;
        padding: 20px 10px;
    }

    .bill .billBox {
        min-height: 100px;
        padding: 20px 12px;
        box-sizing: border-box;
        background-color: #F9FAFE;
        color: #5f5f5f;
    }

    .billBox h3 {
        padding-bottom: 12px;
        font-size: 12px;
    }

    .billBox p {
        font-style: normal;
        font-size: 30px;
        font-weight: 500;
        color: #009C5E;
    }

    .bill-title {
        width: 100%;
        height: 40px;
        padding: 0 20px;
        font-size: 15px;
        font-weight: 500;
        background: #F9FAFE;
        position: relative;
        display: flex;
        align-items: center;
        /*margin: 10px 0;*/
        box-sizing: border-box;
    }

    .bill-title:before {
        content: " ";
        display: inline-block;
        width: 4px;
        height: 16px;
        background: #009C5E;
        margin-right: 10px;
    }

    .viewBill label {
        width: 120px;
    }

    .viewBill input[type='text']:not(.layui-unselect), .viewBillBorderNone {
        border: none;
    }

    .viewBill input[type='text'].viewBillBorderShow {
        border: 1px solid #e6e6e6;
    }

    .viewBill textarea {
        resize: none;
        width: 300px;
        height: 80px;
        box-sizing: border-box;
        padding: 10px;
    }

    .layui-table-cell {
        height: auto;
        max-height: 80px;
    }

    .colorRed {
        color: #ff0000;
    }

    .capital .capitalBoxList {
        background-color: #F9FAFE;
        padding: 20px 0;
        border-top: solid #fff 2px;
        min-height: 580px;
    }

    .capitalBoxList label {
        padding: 9px 5px;
        width: 100px;
    }

    .capitalBoxList input {
        border: none;
        background-color: #F9FAFE;
    }

    .mergeInfo {
        float: left;
    }

    .mergeInfo .layui-input-block {
        margin-left: 0;
    }

    .mergeInfo label {
        width: 45px;
    }

    .mergeInfo .layui-input-inline {
        width: 300px;
        margin-bottom: 10px;
    }

    .settlementInfoView label, .invoiceInfoView label {
        width: 100px;
    }
</style>

<script type="text/html" id="billTableBar">
    <a class="layui-btn layui-btn-xs" lay-event="details">详情</a>

    {{# if(d.billStatus=="confirm"){  }}
    <a class="layui-btn layui-btn-xs layui-btn-normal" lay-event="viewBillBtn">确认</a>
    {{# }else if(d.billStatus == "insettle" || d.billStatus == "settled"){ }}
    <a class="layui-btn layui-btn-xs layui-btn-danger" lay-event="settlementInfoBtn">结算信息</a>
    <a class="layui-btn layui-btn-xs layui-btn-warm" lay-event="invoiceInfoBtn">发票信息</a>
    {{# }else{ }}
    {{# } }}


</script>

<!--详情弹窗-->
<script type="text/html" id="billDetails">
    <div class="layui-card">
        <div class="layui-card-body">
            <!--    账单详情统计        -->
            <div class="layui-field-box">
                <div class="bill-title">柜子业务月度统计</div>
                <div class="layui-row layui-col-space10 bill">
                    <div class="layui-col-md2">
                        <div class="billBox">
                            <h3>账单总应结金额（元人民币）</h3>
                            <p id="xq_billTotalMoney"></p>
                        </div>
                    </div>
                    <div class="layui-col-md2">
                        <div class="billBox">
                            <h3>账单订单数</h3>
                            <p id="xq_billOrdAmount"></p>
                        </div>
                    </div>
                    <div class="layui-col-md2">
                        <div class="billBox">
                            <h3>账单已结算金额</h3>
                            <p id="xq_billSettledMoney"></p>
                        </div>
                    </div>
                    <div class="layui-col-md2">
                        <div class="billBox">
                            <h3>账单未结算金额（元人民币）</h3>
                            <p id="xq_billNosettledMoney"></p>
                        </div>
                    </div>
                    <div class="layui-col-md2">
                        <div class="billBox">
                            <h3>账单已开票金额</h3>
                            <p id="xq_billInvoicedMoney"></p>
                        </div>
                    </div>
                    <div class="layui-col-md2">
                        <div class="billBox">
                            <h3>账单未开票金额</h3>
                            <p id="xq_billNoinvoicedMoney"></p>
                        </div>
                    </div>
                </div>
            </div>

            <!-- 收款 结算 发票信息  -->
            <div class="layui-field-box capital">
                <div class="layui-row layui-col-space10">
                    <div class="layui-col-md4">
                        <div class="bill-title">收款账户信息</div>
                        <div class="capitalBoxList">
                            <form class="layui-form model-form" lay-filter="moneyCollectAccountInfoForm"
                                  style="padding: 0">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">开户行:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="incomeBank" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">账户:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="incomeAccount" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">账号:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="payNumber" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">账单金额:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="billTotalMoney" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">账单起止时间:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="startTime" class="layui-input" disabled>
                                        <input type="text" name="endTime" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">账单出账时间:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="createTime" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">账单备注:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="examineRemark" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">账单确认人:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="confirmName" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">账单确认结果:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="confirmResultDesc" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">账单确认时间:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="confirmTime" class="layui-input" disabled>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <div class="layui-col-md4">
                        <div class="bill-title">结算信息</div>
                        <div class="capitalBoxList">
                            <form class="layui-form model-form" lay-filter="settlementInformationForm"
                                  style="padding: 0">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">开户行:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="payBank" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">账户:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="payAccount" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">账号:</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="payNumber" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">账单金额</label>
                                    <div class="layui-input-block">
                                        <input type="hidden" name="payMoney" class="layui-input" disabled>
                                        <span style="line-height: 38px;padding-left: 10px" id="payMoneySpan"></span>
                                        <a class="layui-btn-xs" id="payMoneyBtn" style="display: none">查看结算信息</a>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">付款凭证</label>
                                    <div class="layui-input-block">
                                        <div id="payFile_path" class="uploadImgStyle"></div>
                                        <input name="payFile" type="hidden" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">付款凭证号</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="payFileNo" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">付款时间</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="createTime" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">付款人</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="payName" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">付款方式</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="payModeDesc" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">付款备注</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="remark" class="layui-input" disabled>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                    <div class="layui-col-md4">
                        <div class="bill-title">发票信息</div>
                        <div class="capitalBoxList">
                            <form class="layui-form model-form" lay-filter="invoiceInfoForm" style="padding: 0">
                                <div class="layui-form-item">
                                    <label class="layui-form-label">发票总金额</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="invoiceMoney" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">发票税额</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="taxMoney" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">发票税率</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="taxRate" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">发票张数</label>
                                    <div class="layui-input-block">
                                        <input type="hidden" name="count" class="layui-input-inline" disabled>
                                        <span style="line-height: 38px;padding-left: 10px" id="countSpan"></span>
                                        <a class="layui-btn-xs" id="countBtn" style="display: none">查看开票记录</a>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">发票凭证</label>
                                    <div class="layui-input-block">
                                        <div id="xq_invoiceFile_path" class="uploadImgStyle"></div>
                                        <input name="invoiceFile" type="hidden" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">开票时间</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="createTime" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">开票人</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="drawer" class="layui-input" disabled>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-form-label">开票备注</label>
                                    <div class="layui-input-block">
                                        <input type="text" name="remark" class="layui-input" disabled>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
            <!--   账单列表        -->
            <table class="layui-table" id="billDetailsTable" lay-filter="billDetailsTable"></table>
        </div>
    </div>
</script>

<!--审核账单-->
<!--viewBill-->
<script type="text/html" id="viewBill">
    <div class="layui-card viewBill">
        <div class="layui-card-body">
            <form lay-filter="viewBillForm" class="layui-form model-form">
                <input name="id" type="hidden"/>
                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="colorRed">*</span>账单编号</label>
                    <div class="layui-input-inline">
                        <input name="billNo" class="layui-input" type="text" readonly="readonly"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="colorRed">*</span>账单起止时间</label>
                    <div class="layui-input-inline">
                        <input name="startTime" class="layui-input" type="text" readonly="readonly"/>
                        <input name="endTime" class="layui-input" type="text" readonly="readonly"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="colorRed">*</span>我方付款账号</label>
                    <div class="mergeInfo">
                        <div class="layui-input-block">
                            <label class="layui-form-label ">开户行</label>
                            <div class="layui-input-inline">
                                <input name="payBank" class="layui-input viewBillBorderShow" type="text" readonly="readonly"/>
                            </div>
                        </div>
                        <div class="layui-input-block">
                            <label class="layui-form-label">账户</label>
                            <div class="layui-input-inline">
                                <input name="payAccount" class="layui-input viewBillBorderShow" type="text" readonly="readonly"/>
                            </div>
                        </div>
                        <div class="layui-input-block">
                            <label class="layui-form-label">账号</label>
                            <div class="layui-input-inline">
                                <input name="payNumber" class="layui-input viewBillBorderShow" type="text" readonly="readonly"/>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="colorRed">*</span>对方收款账号</label>
                    <div class="mergeInfo">
                        <div class="layui-input-block">
                            <label class="layui-form-label ">开户行</label>
                            <div class="layui-input-inline">
                                <input name="incomeBank" class="layui-input viewBillBorderShow" type="text" readonly="readonly"/>
                            </div>
                        </div>
                        <div class="layui-input-block">
                            <label class="layui-form-label ">账户</label>
                            <div class="layui-input-inline">
                                <input name="incomeAccount" class="layui-input viewBillBorderShow" type="text" readonly="readonly"/>
                            </div>
                        </div>
                        <div class="layui-input-block">
                            <label class="layui-form-label ">账号</label>
                            <div class="layui-input-inline">
                                <input name="incomeNumber" class="layui-input viewBillBorderShow" type="text" readonly="readonly"/>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="colorRed">*</span>账单金额</label>
                    <div class="layui-input-inline">
                        <input name="billTotalMoney" class="layui-input" type="text" readonly="readonly"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="colorRed">*</span>优惠金额</label>
                    <div class="layui-input-inline">
                        <input name="discountMoney" class="layui-input" type="text" readonly="readonly"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="colorRed">*</span>最终金额</label>
                    <div class="layui-input-inline">
                        <input name="finalMoney" class="layui-input" type="text" readonly="readonly"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label ">确认结果</label>
                    <div class="layui-input-inline">

                        <select name="confirmResult" lay-verify="required" id="confirmResult"
                                lay-filter="confirmResult">
                            <option value="">请选择</option>
                            <option value="pass">相符</option>
                            <option value="refuse">不相符</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label ">内部备注</label>
                    <div class="layui-input-block">
                        <textarea name="confirmRemark"></textarea>
                    </div>
                </div>
                <div class="layui-form-item" id="confirmRefuseRemarkBox" style="display: none">
                    <label class="layui-form-label ">驳回备注留言</label>
                    <div class="layui-input-block">
                        <textarea name="confirmRefuseRemark" id="confirmRefuseRemark"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"></label>
                    <div class="layui-input-inline">
                        <button class="layui-btn" type="button" lay-submit="" lay-filter="viewBillSubmit">提交</button>
                    </div>
                </div>

            </form>
        </div>
    </div>
</script>

<!--結算信息-->
<!--settlementInfoView-->
<script type="text/html" id="settlementInfoView">
    <div class="layui-card settlementInfoView">
        <div class="layui-card-body">
            <form lay-filter="settlementInfoViewForm" class="layui-form model-form">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">起始日期:</label>
                        <div class="layui-input-inline">
                            <input name="settlementInfo_createTime" id="settlementInfo_pTime"
                                   class="layui-input date-icon" type="text" placeholder="选择时间" style="width: 200px"/>
                        </div>
                        <input name="startTime" id="settlementInfo_sTime" type="hidden"/>
                        <input name="endTime" id="settlementInfo_eTime" type="hidden"/>
                    </div>
                    <div class="layui-inline">
                        <a class="layui-btn" lay-submit lay-filter="settlementInfoViewFormSearch">搜索</a>
                    </div>
                </div>
                <div class="layui-form-item">
                    <a class="layui-btn" id="addPaymentInfo">添加支付凭证信息</a>
                </div>
                <div class="layui-form-item">
                    <!--   账单列表        -->
                    <table class="layui-table" id="settlementInfoViewTable"
                           lay-filter="settlementInfoViewTable"></table>
                </div>
            </form>
        </div>
    </div>
</script>

<!--结算信息 操作-->
<!--settlementInfoBar-->
<script type="text/html" id="settlementInfoBar">
    <a class="layui-btn layui-btn-xs" lay-event="settlementInfoDetailsBtn">详情</a>
</script>

<!--結算信息 支付凭证信息和详情-->
<!--settlementInfoDetails-->
<script type="text/html" id="settlementInfoDetails">
    <div class="layui-card viewBill">
        <div class="layui-card-body">
            <form lay-filter="settlementInfoDetailsForm" class="layui-form model-form settlementInfoDetails">
                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="colorRed">*</span>账单编号</label>
                    <div class="layui-input-inline">
                        <input name="billNo" class="layui-input viewBillBorderNone" type="text" readonly="readonly"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="colorRed">*</span>账单起止时间</label>
                    <div class="layui-input-inline">
                        <input name="startTime" class="layui-input viewBillBorderNone" type="text" readonly="readonly"/>
                        <input name="endTime" class="layui-input viewBillBorderNone" type="text" readonly="readonly"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="colorRed">*</span>结算账号</label>
                    <div class="mergeInfo">
                        <div class="layui-input-block">
                            <label class="layui-form-label ">开户行</label>
                            <div class="layui-input-inline">
                                <input name="payBank" class="layui-input viewBillBorderNone" type="text"
                                       readonly="readonly"/>
                            </div>
                        </div>
                        <div class="layui-input-block">
                            <label class="layui-form-label ">账户</label>
                            <div class="layui-input-inline">
                                <input name="payAccount" class="layui-input viewBillBorderNone" type="text"
                                       readonly="readonly"/>
                            </div>
                        </div>
                        <div class="layui-input-block">
                            <label class="layui-form-label ">账号</label>
                            <div class="layui-input-inline">
                                <input name="payNumber" class="layui-input viewBillBorderNone" type="text"
                                       readonly="readonly"/>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="colorRed">*</span>账单金额</label>
                    <div class="layui-input-inline">
                        <input name="billTotalMoney" class="layui-input viewBillBorderNone" type="text"
                               readonly="readonly"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label ">付款方式</label>
                    <div class="layui-input-inline">
                        <select name="payMode" lay-verify="required" id="payMode">
                            <option value="">请选择付款方式</option>
                            <option value="online">网银转账</option>
                            <option value="offline">线下汇款</option>
                            <option value="cash">现金</option>
                            <option value="other">其他</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label ">付款账号</label>
                    <div class="layui-input-inline">
                        <input type="text" name="payNumber" class="layui-input viewBillBorderNone" readonly="readonly">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label ">支付币种</label>
                    <div class="layui-input-inline">
                        <select name="currency" lay-verify="required">
                            <option value="">请输入</option>
                            <option value="RMB">人民币(元)</option>
                            <option value="dollar">美元</option>
                            <option value="other ">其他</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">付款金额</label>
                    <div class="layui-input-inline">
                        <input name="payMoney" class="layui-input" type="number" lay-verify="required" value=""/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">付款凭证号</label>
                    <div class="layui-input-inline">
                        <input name="payFileNo" class="layui-input viewBillBorderShow" type="text" lay-verify="required"
                               value=""/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">支付凭证附件</label>
                    <div class="layui-input-block">
                        <div id="devicePic_path" class="uploadImgStyle"></div>
                        <div id="devicePicBtn" class="layui-btn" style="float: left;"><i class="layui-icon">&#xe681;</i>上传图片
                        </div>
                        <input name="payFile" type="hidden" class="layui-input" lay-verify="" id="payFile"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">客户备注留言</label>
                    <div class="layui-input-inline">
                        <textarea name="remark"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">结算说明</label>
                    <div class="layui-input-inline">
                        <textarea name="settleRemark"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">账单审核人</label>
                    <div class="layui-input-inline">
                        <input type="text" name="billAuditor" class="layui-input viewBillBorderNone">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">是否本人转账</label>
                    <div class="layui-input-inline">
                        <select name="transferor" lay-filter="transferor" readonly="readonly">
                            <option value="">请选择</option>
                            <option value="self">是本人(当前账号)</option>
                            <option value="other">不是本人(不是当前账号)</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item" id="payNameBox" style="display: none">
                    <label class="layui-form-label">支付操作人</label>
                    <div class="layui-input-inline">
                        <input name="payName" type="text" class="layui-input viewBillBorderShow" id="payName"/>
                    </div>
                </div>
                <div class="layui-form-item" id="settlementInfoDetailsSubmitBox">
                    <label class="layui-form-label"></label>
                    <div class="layui-input-inline">
                        <a class="layui-btn" type="button" lay-submit lay-filter="settlementInfoDetailsSubmit">提交</a>
                    </div>
                </div>
            </form>
        </div>
    </div>
</script>

<!--发票信息-->
<!--invoiceInfoView-->
<script type="text/html" id="invoiceInfoView">
    <div class="layui-card invoiceInfoView">
        <div class="layui-card-body">
            <form lay-filter="invoiceInfoViewForm" class="layui-form model-form">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">起始日期:</label>
                        <div class="layui-input-inline">
                            <input name="invoiceInfo_createTime" id="invoiceInfo_pTime" class="layui-input date-icon"
                                   type="text" placeholder="选择时间" style="width: 200px"/>
                        </div>
                        <input name="startTime" id="invoiceInfo_sTime" type="hidden"/>
                        <input name="endTime" id="invoiceInfo_eTime" type="hidden"/>
                    </div>
                    <div class="layui-inline">
                        <a class="layui-btn" lay-filter="invoiceInfoViewFormSearch" lay-submit>搜索</a>
                    </div>
                </div>
                <div class="layui-form-item">
                    <!--   账单列表        -->
                    <table class="layui-table" id="invoiceInfoViewTable" lay-filter="invoiceInfoViewTable"></table>
                </div>
            </form>
        </div>
    </div>
</script>

<!--发票信息 操作-->
<!--invoiceInfoViewBar-->
<script type="text/html" id="invoiceInfoViewBar">
    <a class="layui-btn layui-btn-xs" lay-event="invoiceInfoViewDetailsBtn">详情</a>
</script>

<!--发票信息 详情-->
<!--invoiceInfoDetails-->
<script type="text/html" id="invoiceInfoDetails">
    <div class="layui-card viewBill">
        <div class="layui-card-body">
            <form lay-filter="invoiceInfoDetailsForm" class="layui-form model-form">
                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="colorRed">*</span>账单编号</label>
                    <div class="layui-input-inline">
                        <input name="billNo" class="layui-input" type="text" readonly="readonly"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="colorRed">*</span>开票企业名称</label>
                    <div class="layui-input-inline">
                        <input name="enterpriseName" class="layui-input" type="text" readonly="readonly"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="colorRed">*</span>供应商结算账号</label>
                    <div class="mergeInfo">
                        <div class="layui-input-block">
                            <label class="layui-form-label ">开户行</label>
                            <div class="layui-input-inline">
                                <input name="incomeBank" class="layui-input" type="text" readonly="readonly"/>
                            </div>
                        </div>
                        <div class="layui-input-block">
                            <label class="layui-form-label ">账户</label>
                            <div class="layui-input-inline">
                                <input name="incomeAccount" class="layui-input" type="text" readonly="readonly"/>
                            </div>
                        </div>
                        <div class="layui-input-block">
                            <label class="layui-form-label ">账号</label>
                            <div class="layui-input-inline">
                                <input name="incomeNumber" class="layui-input" type="text" readonly="readonly"/>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="colorRed">*</span>账单起止时间</label>
                    <div class="layui-input-inline">
                        <input name="startTime" class="layui-input" type="text" readonly="readonly"/>
                        <input name="endTime" class="layui-input" type="text" readonly="readonly"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="colorRed">*</span>付款账号</label>
                    <div class="mergeInfo">
                        <div class="layui-input-block">
                            <label class="layui-form-label ">开户行</label>
                            <div class="layui-input-inline">
                                <input name="payBank" class="layui-input" type="text" readonly="readonly"/>
                            </div>
                        </div>
                        <div class="layui-input-block">
                            <label class="layui-form-label ">账户</label>
                            <div class="layui-input-inline">
                                <input name="payAccount" class="layui-input" type="text" readonly="readonly"/>
                            </div>
                        </div>
                        <div class="layui-input-block">
                            <label class="layui-form-label ">账号</label>
                            <div class="layui-input-inline">
                                <input name="payNumber" class="layui-input" type="text" readonly="readonly"/>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="colorRed">*</span>账单金额</label>
                    <div class="layui-input-inline">
                        <input name="billTotalMoney" class="layui-input" type="text" readonly="readonly"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="colorRed">*</span>结算状态</label>
                    <div class="layui-input-inline">
                        <input name="billStatus" class="layui-input" type="text" readonly="readonly"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label "><span class="colorRed">*</span>账单确认人</label>
                    <div class="layui-input-inline">
                        <input name="confirmName" class="layui-input" type="text" readonly="readonly"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">账单确认时间</label>
                    <div class="layui-input-inline">
                        <input name="confirTime" class="layui-input" type="text" readonly="readonly"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">已开票数量</label>
                    <div class="layui-input-inline">
                        <input name="num" class="layui-input" type="text" readonly="readonly"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">待开票金额</label>
                    <div class="layui-input-inline">
                        <input name="pendingMoney" class="layui-input" type="text" readonly="readonly"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">发票科目</label>
                    <div class="layui-input-inline">
                        <input name="invoiceSubject" class="layui-input" type="text" readonly="readonly"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">发票税号</label>
                    <div class="layui-input-inline">
                        <input name="invoiceTaxno" class="layui-input" type="text" readonly="readonly"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">开票金额</label>
                    <div class="layui-input-inline">
                        <input name="invoiceMoney" class="layui-input" type="text" readonly="readonly"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">发票附件</label>
                    <div class="layui-input-block">
                        <div id="invoiceFile_path" class="uploadImgStyle"></div>
                        <input name="invoiceFile" type="hidden" class="layui-input" lay-verify="" id="invoiceFile"/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">客户备注留言</label>
                    <div class="layui-input-inline">
                        <textarea name="remark" disabled></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">开票操作人</label>
                    <div class="layui-input-inline">
                        <input name="drawer" class="layui-input" type="text" readonly="readonly"/>
                    </div>
                </div>
            </form>
        </div>
    </div>
</script>


<!-- js部分 -->
<script>
    layui.use(['layer', 'form', 'table', 'admin', 'laydate', 'upload'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var config = layui.config;
        var admin = layui.admin;
        var upload = layui.upload;
        var laydate = layui.laydate;
        var util = layui.util;

        //时间范围
        laydate.render({
            elem: '#pTime',
            type: 'date',
            range: true,
            done: function (value, date, endDate) {
                if(value) {
                    let dateValue = value.split(" - ");
                    $("#sTime").val(dateValue[0] + " 00:00:00");
                    $("#eTime").val(dateValue[1] + " 23:59:59");
                }else {
                    $("#sTime").val("");
                    $("#eTime").val("");
                }
            }
        });

        //柜子业务月度统计
        admin.req('enterprisecab/bill/admin/billOrdInformation/billCensus', {type: 0}, function (res) {
            if (res.code == 200) {
                $("#totalMoney").text(res.data.totalMoney);
                $("#billSettledMoney").text(res.data.billSettledMoney);
                $("#billNosettledMoney").text(res.data.billNosettledMoney);
                $("#lastTotalMoney").text(res.data.lastTotalMoney);
                $("#NowBillSettledMoney").text(res.data.NowBillSettledMoney);
                $("#count").text(res.data.count);
            }
        }, 'GET', false);

        //渲染表格
        var billTb = table.render({
            elem: '#billTable',
            url: config.base + 'enterprisecab/bill/admin/billOrdInformation/list',
            page: true,
            cellMinWidth: 130,
            cols: [[
                {type: 'numbers',title: '序号'}
                /*{field: 'id', title: 'ID'}*/
                , {field: 'billNo', title: '账单编号'}
                , {field: 'startTime', title: '账单开始时间'}
                , {field: 'endTime', title: '账单结束时间'}
                , {field: 'billOrdAmount', title: '子订单数'}
                , {field: 'billTotalMoney', title: '账单总金额'}
                , {field: 'createTime', sort: true, title: '生成时间'}
                , {field: 'billStatusDesc', title: '状态'}
                , {field: 'invoiceStatusDesc', title: '开票状态'}
                , {field: 'billAuditor', sort: true, title: '审核人'}
                , {align: 'left', toolbar: '#billTableBar', title: '操作', width: 300}
            ]]
        });

        // 工具条点击事件
        table.on('tool(billTable)', function (obj) {
            var data = obj.data;
            if (obj.event === 'details') { //详情
                showBillDetails(data);
            } else if (obj.event === 'viewBillBtn') { // 确认
                showViewBill(data);
            } else if (obj.event === 'settlementInfoBtn') { //結算信息
                showSettlementInfoView(data);
            } else if (obj.event === 'invoiceInfoBtn') { // 发票信息
                showInvoiceInfo(data);
            }
        });

        // 搜索
        form.on('submit(formSubSearchLog)', function (data) {
            billTb.reload({where: data.field, page: {curr: 1}});
        });

        // 重置搜索
        form.on('submit(resets)', function (data) {
            $(".lay-header").find('select').val("");
            $(".lay-header").find('input').val("");
            let field = data.field;
            for (let key in field) {
                field[key] = ''
            }
            billTb.reload({where: field, page: {curr: 1}}, 'data');
        });

        //详情弹窗
        function showBillDetails(data) {
            admin.open({
                type: 1,
                area: ['1540px', '800px'],
                offset: '65px',
                title: '详情',
                content: $('#billDetails').html(),
                success: function () {
                    //柜子业务月度统计
                    admin.req('enterprisecab/bill/admin/billOrdInformation/billCensusDetail', {'billNo': data.billNo}, (res) => {
                        if (res.code == '200') {
                            $('#xq_billTotalMoney').text(res.data.totalMoney);
                            $('#xq_billOrdAmount').text(res.data.amount);
                            $('#xq_billSettledMoney').text(res.data.settled);
                            $('#xq_billNosettledMoney').text(res.data.noSettled);
                            $('#xq_billInvoicedMoney').text(res.data.invoiced);
                            $('#xq_billNoinvoicedMoney').text(res.data.pending);
                        } else {
                            $('#xq_billTotalMoney').text('');
                            $('#xq_billOrdAmount').text('');
                            $('#xq_billSettledMoney').text('');
                            $('#xq_billNosettledMoney').text('');
                            $('#xq_billInvoicedMoney').text('');
                            $('#xq_billNoinvoicedMoney').text('');
                        }
                    }, 'GET')

                    // 收款账户信息
                    admin.req('enterprisecab/bill/admin/billOrdInformation/list', {'billNo': data.billNo}, (res) => {
                        if (res.code == '200' && res.data.length > 0) {
                            form.val('moneyCollectAccountInfoForm', res.data[0]);
                        }
                    }, 'GET');

                    // 结算信息
                    admin.reqSync('enterprisecab/bill/admin/billOrdPayInformation/list', {'billNo': data.billNo}, (res) => {
                        if (res.code == '200' && res.data.length > 0) {
                            form.val('settlementInformationForm', res.data[0]);

                            $('#payFile_path').html('<img src="' + res.data[0].payFile + '">')
                            $('#payMoneySpan').text(res.data[0].payMoney);
                            $('#payMoneyBtn').show();
                        }
                    }, 'GET');

                    admin.reqSync('enterprisecab/bill/admin/billOrdInvoiceInformation/list', {'billNo': data.billNo}, (res) => {
                        if (res.code == '200' && res.data.length > 0) {
                            form.val('invoiceInfoForm', res.data[0]);
                            res.data[0].count = res.count + "张";
                            $('#countSpan').text(res.data[0].count);
                            $('#countBtn').show();
                            $('#xq_invoiceFile_path').html('<img src="' + res.data[0].invoiceFile + '">');
                        }
                    }, 'GET');

                    layer.photos({
                        photos: '.uploadImgStyle'
                        , anim: 5
                    });
                    $('#countBtn').click(_data => {
                        showInvoiceInfo(data);
                    });
                    $("#payMoneyBtn").click(_data => {
                        showSettlementInfoView(data);
                    });

                    let billDetailsFormTb = table.render({
                        elem: '#billDetailsTable',
                        url: config.base + 'enterprisecab/bill/admin/billOrdInformationDetail/list?billNo=' + data.billNo,
                        page: true,
                        cols: [[
                            {type: 'numbers'}
                            /*{field: 'id', title: 'ID',}*/
                            , {field: 'ordNo', title: '订单编号'}
                            , {field: 'productName', title: '领用物料名称'}
                            , {field: 'quantity', title: '领取数量'}
                            , {field: 'price', title: '单价'}
                            , {field: 'totalMoney', title: '总价'}
                            , {field: 'cabCode', title: '所属柜子'}
                            , {field: '', title: '所在车间'}
                            , {field: 'receiver', title: '领用人'}
                            , {field: 'deviceName', title: '使用台机'}
                            , {field: 'collectTime', title: '领用时间'}
                            , {field: 'statusDesc', title: '状态'}
                            , {field: 'createTime', title: '账单时间'}
                        ]]
                    });
                }
            })
        }

        // 显示确认界面
        // showViewBill
        function showViewBill(data) {
            admin.open({
                type: 1,
                area: ['1240px', '800px'],
                offset: '65px',
                title: '确认账单',
                content: $('#viewBill').html(),
                success: function () {
                    data.confirmResult = data.confirmResult ? data.confirmResult : "";
                    form.val('viewBillForm', data);
                    let meIsShow = false, OtherPartyIsShow = false;
                    form.render('select');
                    form.on("select(confirmResult)", function (data) {
                        if (data.value == 'pass') {
                            $('#confirmRefuseRemarkBox').hide();
                        } else if (data.value == 'refuse') {
                            $('#confirmRefuseRemarkBox').show();
                        } else {
                            $('#confirmRefuseRemarkBox').hide();
                        }
                    });
                    $('#viewBillMeModifyBtn').click(() => {
                        meIsShow = !meIsShow;
                        if (meIsShow) {
                            $('#viewBillMeModifyBtn').text('保存');
                            $('#viewBillMeModifyBtn').parent().prev().find('input').removeAttr('readonly');
                            $('#viewBillMeModifyBtn').parent().prev().find('input').css('border', '1px solid #D9D9D9');
                        } else {
                            $('#viewBillMeModifyBtn').text('修改');
                            $('#viewBillMeModifyBtn').parent().prev().find('input').attr('readonly');
                            $('#viewBillMeModifyBtn').parent().prev().find('input').css('border', 'none');
                        }

                    });
                    $('#viewBillOtherPartyModifyBtn').click(() => {
                        OtherPartyIsShow = !OtherPartyIsShow;
                        if (OtherPartyIsShow) {
                            $('#viewBillOtherPartyModifyBtn').text('保存');
                            $('#viewBillOtherPartyModifyBtn').parent().prev().find('input').removeAttr('readonly');
                            $('#viewBillOtherPartyModifyBtn').parent().prev().find('input').css('border', '1px solid #D9D9D9');
                        } else {
                            $('#viewBillOtherPartyModifyBtn').text('修改');
                            $('#viewBillOtherPartyModifyBtn').parent().prev().find('input').attr('readonly');
                            $('#viewBillOtherPartyModifyBtn').parent().prev().find('input').css('border', 'none');
                        }
                    })

                    form.on("submit(viewBillSubmit)", (d) => {
                        d.field.examResult = d.field.examineResult;
                        admin.req('enterprisecab/bill/admin/billOrdInformation/confirmBill', d.field, res => {
                            if (res.code == '200') {
                                layer.msg(res.msg, {'icon': 1});
                                layer.closeAll();
                                table.reload('billTable');
                            } else {
                                layer.msg(res.msg, {'icon': 2});
                            }
                        }, 'PUT')
                    })


                }
            })
        }


        //结算信息
        let isState = false;

        function showSettlementInfoView(data) {
            admin.open({
                type: 1,
                area: '1600px',
                offset: '75px',
                title: '结算信息',
                content: $('#settlementInfoView').html(),
                success: function () {

                    // 添加支付凭证信息
                    $('#addPaymentInfo').click(() => {
                        isState = false;
                        data.remark = undefined;
                        showSettlementInfoDetails(data);
                    })
                    form.render('select');
                    //时间范围
                    laydate.render({
                        elem: '#settlementInfo_pTime',
                        type: 'date',
                        range: true,
                        done: function (value, date, endDate) {
                            var dateValue = value.split(" - ");
                            $("#settlementInfo_sTime").val(dateValue[0]);
                            $("#settlementInfo_eTime").val(dateValue[1]);
                        }
                    });

                    //渲染表格
                    var settlementInfoViewTb = table.render({
                        elem: '#settlementInfoViewTable',
                        url: config.base + 'enterprisecab/bill/admin/billOrdPayInformation/list?billNo=' + data.billNo,
                        page: true,
                        cellMinWidth: 130,
                        cols: [[
                            {type: 'numbers', title: '序号'}
                            , {field: 'payFile', title: '结算凭证', templet: d => "<img src='" + d.payFile + "'/>"}
                            , {field: 'payFileNo', title: '凭证编码'}
                            , {field: 'billNo', title: '所属账单'}
                            , {field: 'incomeAccount', title: '收款企业名称'}
                            , {field: 'payMoney', title: '支付金额'}
                            , {field: 'payNumber', title: '支付账号'}
                            , {field: 'payName', title: '支付人'}
                            , {field: 'createTime', title: '支付时间'}
                            , {align: 'center', toolbar: '#settlementInfoBar', title: '操作'}
                        ]]
                    });
                    //    工具条事件
                    table.on('tool(settlementInfoViewTable)', function (obj) {
                        var _data = obj.data;
                        if (obj.event === 'settlementInfoDetailsBtn') { //详情
                            isState = true;
                            showSettlementInfoDetails(_data);
                        }
                    });

                    //    搜索
                    //    settlementInfoViewFormSearch
                    form.on('submit(settlementInfoViewFormSearch)', function (data) {
                        settlementInfoViewTb.reload({where: data.field, page: {curr: 1}});
                    });
                }
            })
        }

        // settlementInfoDetails
        //結算信息 支付凭证信息和详情弹窗
        function showSettlementInfoDetails(data) {
            let settlementInfoDetailsForm = admin.open({
                type: 1,
                area: ['1240px', '700px'],
                offset: '85px',
                title: isState ? '结算信息详情' : "添加支付凭证信息",
                content: $('#settlementInfoDetails').html(),
                success: function () {
                    if (isState) {
                        $(".settlementInfoDetails input").css('border', 'none');
                        $(".settlementInfoDetails input").attr('readonly', 'readonly');
                        $(".settlementInfoDetails select").css('border', 'none');
                        $(".settlementInfoDetails select").attr('disabled', 'disabled');
                        $(".settlementInfoDetails textarea").attr('disabled', 'disabled');
                        $("#settlementInfoDetailsSubmitBox").hide();
                        $("#devicePicBtn").hide();
                        $('#devicePic_path').html('<img src="' + data.payFile + '"/>');
                        form.val('settlementInfoDetailsForm', data);
                    } else {
                        form.val('settlementInfoDetailsForm', data);
                        $('#devicePicBtn').click(uploadImg('devicePicBtn', 'devicePic_path', 'payFile'));
                        form.on('select(transferor)', data => {
                            if (data.value == 'self') {
                                $('#payNameBox').hide();
                                $('#payName').val('');
                            } else {
                                $('#payNameBox').show();
                            }
                        })

                        form.on('submit(settlementInfoDetailsSubmit)', (d) => {
                            d.field.incomeAccount = data.incomeAccount;
                            d.field.incomeBank = data.incomeBank;
                            d.field.incomeNumber = data.incomeNumber;
                            d.field.type=data.type;
                            admin.req('enterprisecab/bill/admin/billOrdPayInformation/addAll', d.field, res => {
                                if (res.code == '200') {
                                    layer.msg(res.msg, {'icon': 1});
                                    layer.close(settlementInfoDetailsForm);
                                    table.reload('settlementInfoViewTable');
                                } else {
                                    layer.msg(res.msg, {'icon': 2});
                                }
                            }, 'POST')
                        })
                    }
                    // uploadImgStyle
                    layer.photos({
                        photos: '.uploadImgStyle'
                        , anim: 5
                    });
                    form.render('select');

                }
            });
        }

        //发票信息
        // showInvoiceInfo
        function showInvoiceInfo(data) {
            admin.open({
                type: 1,
                area: '1600px',
                offset: '75px',
                title: "账单发票信息",
                content: $('#invoiceInfoView').html(),
                success: function () {
                    form.render('select');
                    //时间范围
                    laydate.render({
                        elem: '#invoiceInfo_pTime',
                        type: 'date',
                        range: true,
                        done: function (value, date, endDate) {
                            let dateValue = value.split(" - ");
                            $("#invoiceInfo_sTime").val(dateValue[0]);
                            $("#invoiceInfo_eTime").val(dateValue[1]);
                        }
                    });

                    //渲染表格
                    var invoiceInfoViewTb = table.render({
                        elem: '#invoiceInfoViewTable',
                        url: config.base + 'enterprisecab/bill/admin/billOrdInvoiceInformation/list?billNo=' + data.billNo,
                        page: true,
                        cellMinWidth: 130,
                        cols: [[
                            {type: 'numbers', title: '序号'}
                            , {field: 'invoiceFile', title: '发票凭证', templet: d => "<img src='" + d.invoiceFile + "'/>"}
                            , {field: 'invoiceNo', title: '发票编码'}
                            , {field: 'billNo', title: '所属账单'}
                            , {field: 'enterpriseName', title: '开票企业名称'}
                            , {field: 'invoiceMoney', title: '开票金额'}
                            , {field: 'taxRate', title: '税率'}
                            , {field: 'taxMoney', title: '税额'}
                            , {field: 'drawer', title: '开票人'}
                            , {field: 'createTime', title: '创建时间'}
                            , {align: 'center', toolbar: '#invoiceInfoViewBar', title: '操作'}
                        ]]
                    });
                    //    工具条事件
                    table.on('tool(invoiceInfoViewTable)', function (obj) {
                        var data = obj.data;
                        if (obj.event === 'invoiceInfoViewDetailsBtn') { //详情
                            showInvoiceInfoDetails(data);
                        }
                    });
                    //    搜索
                    form.on('submit(invoiceInfoViewFormSearch)', function (data) {
                        invoiceInfoViewTb.reload({where: data.field, page: {curr: 1}});
                    });

                }
            })
        }

        //showInvoiceInfoDetails
        //账单信息详情
        function showInvoiceInfoDetails(data) {
            admin.open({
                type: 1,
                area: ['1240px', '700px'],
                offset: '85px',
                title: "账单信息详情",
                content: $('#invoiceInfoDetails').html(),
                success: function () {
                    form.val('invoiceInfoDetailsForm', data);
                    $("#invoiceFile_path").html('<img src="' + data.invoiceFile + '">');
                    form.render('select');
                    layer.photos({
                        photos: '.uploadImgStyle'
                        , anim: 5
                    });
                }
            })
        }

        // 上传图片
        function uploadImg(_elem, pathId, inputId) {
            upload.render({
                elem: '#' + _elem
                , url: config.upload_url + 'uploadFile'
                , data: {}
                , accept: 'file'
                , exts: 'jpg|png|RAR|zip|pdf|txt|doc|docx|xls|xlsx|ppt|pptx'
                , headers: {Authorization: 'Bearer ' + config.getToken()}
                , done: function (res) {
                    if (res.code == 200) {
                        layer.msg(res.msg || "上传成功", {icon: 1});
                        let imagUrl = res.data.url;
                        $('#' + pathId).html('<img src="' + imagUrl + '"/>');
                        $('#' + inputId).val(imagUrl);
                    } else if (res.code == 502) {
                        return location.replace('admin/login.html');
                    } else {
                        layer.msg(res.msg || "上传失败", {icon: 2});
                    }
                }
            });
        }

    });
</script>
